package common;

import lombok.SneakyThrows;

import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;

/**
 * @author : wenchao.long
 * @date : Created in 2024-03-14 上午 8:55 周四
 * @description :
 */
public class West {

	public static volatile boolean isDead = false;


	public static void main(String[] args) throws InterruptedException {
		Thread thread = new Thread("container-1") {
			@SneakyThrows
			@Override
			public void run() {
				while (!isDead) {
					System.out.println("----试探一下----"+ LocalDateTime.now());
					TimeUnit.SECONDS.sleep(4);
				}
			}
		};
		thread.setDaemon(false);

		thread.start();

		// 主线程暂停40s
		TimeUnit.SECONDS.sleep(40);
		isDead = true;
	}

}
